# 获取性别
def get_gender(id_number):
    gender_code = id_number[-2]
    if int(gender_code) % 2 == 0:
        return "女"
    else:
        return "男"
# 用户注册
id = input("请输入ID（长度不能超过8位，只能由数字、字母、下划线组成）：")
if len(id) > 8:
    print("ID长度超过8位！")
elif not id.isalnum() and "_" not in id:
    print("ID只能由数字、字母、下划线组成！")
else:
    email = input("请输入EMAIL地址：")
    if "@" not in email or "." not in email:
        print("EMAIL地址不合法！")
    else:
        id_number = input("请输入身份证号：")
        if len(id_number) != 18:
            print("身份证号长度错误！")
        else:
            name = input("请输入姓名（只能中文且不能超过4位）：")
            if not all('\u4e00' <= char <= '\u9fff' for char in name) or len(name) > 4:
                print("姓名不合法！")
            else:
                print("注册成功！")
                print("ID：", id)
                print("EMAIL地址：", email)
                print("身份证号：", id_number)
                print("姓名：", name)
                print("性别：", get_gender(id_number))